package com.foot.travel.viewholder;

import java.util.List;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;

import com.foot.travel.R;
import com.koalac.ironman.common.adapter.ViewHolderModel;
import com.koalac.ironman.net.pojo.response.MyTravelItem;

public class MyTraveItemViewholder extends ViewHolderModel<MyTravelItem>{
    
    private TextView date;
    private TextView location;
    private TextView status;
    
    
    public MyTraveItemViewholder(Context context, List<MyTravelItem> list) {
	super(context, list);
	
    }

    @Override
    public void initViewHoler(int position, View convertView) {
	date = (TextView) convertView.findViewById(R.id.date);
	location = (TextView) convertView.findViewById(R.id.location);
	status = (TextView) convertView.findViewById(R.id.status);
    }

    @Override
    public void setViewHolerValues(int position, View convertView) {
	MyTravelItem myTravelItem = list.get(position);
	date.setText(myTravelItem.getStart_date());
	location.setText(myTravelItem.getProduct_name());
	int flag = myTravelItem.getFlag();
	if (flag == 0) {
	    status.setText("未付款");
	    status.setTextColor(context.getResources().getColor(R.color.to_pay));
	    Drawable rightDrawable = context.getResources().getDrawable(R.drawable.right);  
            rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight());  
            status.setCompoundDrawables(null, null, rightDrawable, null);  
	}else {
	    status.setText("已付款");
	    status.setTextColor(context.getResources().getColor(R.color.paid));
	    status.setCompoundDrawables(null, null, null, null);  
	}
    }

}
